#!/bin/bash

# 检查NFS服务是否已安装
if rpm -q nfs-utils &>/dev/null || rpm -q nfs4-acl-tools &>/dev/null; then
    echo "[-] 检测失败: NFS服务已安装"
    
    # 显示已安装的NFS相关包
    echo "    已安装的NFS相关包:"
    if rpm -q nfs-utils &>/dev/null; then
        echo "    - nfs-utils ($(rpm -q nfs-utils))"
    fi
    if rpm -q nfs4-acl-tools &>/dev/null; then
        echo "    - nfs4-acl-tools ($(rpm -q nfs4-acl-tools))"
    fi
    
    # 检查服务状态
    if systemctl is-active nfs-server >/dev/null 2>&1; then
        echo "    nfs-server服务正在运行"
    fi
    if systemctl is-enabled nfs-server >/dev/null 2>&1; then
        echo "    nfs-server服务已启用"
    fi
    
    exit 1
else
    echo "[+] 检测通过: NFS服务未安装"
    exit 0
fi

